(function($){$.fn.loadSelect = function(optionsDataArray,isAddChoose){ 
    return this.each(function(){  
        if(this.tagName == 'SELECT'){  
            var selectElement = this;  
            $.each(optionsDataArray, function(index, optionData){  
            	var addOption = new Option(optionData.text, optionData.value);
//            	if(index == 0){
//            		addOption.selected = true;  
//            	}
                selectElement.options.add(addOption);  
            });  
        }  
    });  
};  
  
$.fn.childSelect = function(selector, makeURL){  
    var elem = this[0];  
    //if(selector === undefined){  
      //  return elem.child ? this.pushStack(elem.child) : undefined;  
   // }  
  
    elem.child = $(selector);  
    this.change(function(event){  
       // var childSelect = $(this).childSelect();  
        //childSelect.emptySelect();  
    	elem.child.emptySelect(); 
        if($(this).val()){  
        	elem.child.attr('disabled', false);  
            $.get(makeURL.apply($(this)),{}, function(data){  
            	elem.child.loadSelect(data).change();
            	resetWidth(elem.child);
            });  
        }else{  
        	elem.child.attr('disabled', true);  
        }  
       // if(childSelect.childSelect()) childSelect.change();  
    });  
   // return this.pushStack(elem.child);  
};  
  
$.fn.emptySelect = function(){  
    return this.each(function(){  
        if(this.tagName == 'SELECT')  
            this.options.length = 0;  
    });  
};})(jQuery); 